package baidu.qiuzhao;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Student[] stu = new Student[n];
        int maxa = 0, maxb = 0, maxc = 0;//蛋壳最高分

        for (int i = 0; i < n; ++i) {
            int a = scanner.nextInt();
            stu[i] = new Student(a);
            maxa = Math.max(a, maxa);
        }
        for (int i = 0; i < n; ++i) {
            int b = scanner.nextInt();
            stu[i].b = b;
            maxb = Math.max(b, maxb);
        }
        for (int i = 0; i < n; ++i) {
            int c = scanner.nextInt();
            stu[i].c = c;
            stu[i].total = stu[i].a + stu[i].b + stu[i].c;
            maxc = Math.max(c, maxc);
        }

        int ans = 0, max = 0;
        for (int i = 0; i < n; ++i) {
            if (stu[i].total >= 400 && stu[i].a >= 120 &&
                    stu[i].b >= 120 && stu[i].c >= 120) {
                stu[i].money += 500;
            } else if (stu[i].total >= 350 && stu[i].a >= 90 &&
                    stu[i].b >= 90 && stu[i].c >= 90) {
                stu[i].money += 300;
            }
            if (stu[i].a == maxa) {
                stu[i].money += 200;
            }
            if (stu[i].b == maxb) {
                stu[i].money += 200;
            }
            if (stu[i].c == maxc) {
                stu[i].money += 200;
            }
//            System.out.println(stu[i].money);
            ans += stu[i].money;
            max = Math.max(max, stu[i].money);
        }
        System.out.println(ans + " " + max);

    }
}

class Student {
    int a, b, c;//蛋壳成绩
    int total;//总分
    int money;//所获奖学金

    public Student(int a) {
        this.a = a;
    }
}